package com.gift.recommendation.modules.admin.service;

import com.gift.recommendation.modules.admin.dao.entity.GoodsEntity;
import com.gift.recommendation.modules.admin.dao.mapper.GoodsMapper;
import com.gift.recommendation.modules.admin.dto.*;
import com.gift.recommendation.modules.user.dto.OrderReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author zzh <2658137258@qq.com>
 * @date 2023/2/2
 */
@Component
public class GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    public void insertSelective(GoodsEntity goodsEntity){
        goodsMapper.insertSelective(goodsEntity);
    }

    public GoodsEntity selectByPrimaryKey(Long id){
        return goodsMapper.selectByPrimaryKey(id);
    }

    public void deleteByPrimaryKey(Long id){
        goodsMapper.deleteByPrimaryKey(id);
    }

    public List<GoodsEntityRsp> selectList(GoodsListReq req) {
        return goodsMapper.selectList(req);
    }

    public void updateByPrimaryKeySelective(GoodsEntity goodsEntity){
        goodsMapper.updateByPrimaryKeySelective(goodsEntity);
    }

    public GoodsEntity selectOneByExample(Example example){
        return goodsMapper.selectOneByExample(example);
    }

    public void updateByExampleSelective(GoodsEntity goodsEntity,Example example){
        goodsMapper.updateByExampleSelective(goodsEntity,example);
    }

    public void updateStock(OrderReq req) {
        goodsMapper.updateStock(req);
    }

    public List<GoodsEntity> selectByExample(Example example) {
        return goodsMapper.selectByExample(example);
    }

    public List<GoodsSaleStatusRsp> goodsSaleStatus(GoodsSaleStatusReq req) {
        return goodsMapper.goodsSaleStatus(req);
    }
}
